<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.8.16.custom.css" />
<link rel="stylesheet" type="text/css" href="css/validator.css" />
<link rel="stylesheet" href="css/howitworks.css" />
<link rel="stylesheet" href="css/common.css" />
<link rel="stylesheet" href="css/pixie.css" />

<script type="text/javascript" language="javascript" src="js/jquery-1.6.4.js"></script>
<script type="text/javascript" src="js/jquery.ui.datepicker.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.bgiframe-2.1.2.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.core.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.widget.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.mouse.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.button.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.draggable.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.position.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.resizable.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.dialog.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.effects.core.js"></script>

<title>简历预览</title>

<%
String submit_result = session.getAttribute( "submit_result") == null ? "-1" : session.getAttribute( "submit_result").toString(); 
%>

<style>
table {
	FONT-SIZE: 12px;
	LINE-HEIGHT: 150%;
	FONT-FAMILY: '宋体'
}

td {
	FONT-SIZE: 18px;
	COLOR: black;
	LINE-HEIGHT: 150%;
	FONT-FAMILY: '宋体';
}

P {
	FONT-SIZE: 12px;
	LINE-HEIGHT: 150%;
	FONT-FAMILY: '宋体'
}

.blue {
	COLOR: #256fb8
}

A:link {
	COLOR: #296ebb;
	TEXT-DECORATION: none
}

A:visited {
	COLOR: black;
	TEXT-DECORATION: none
}

.cvtitle {
	font-weight: 700;
	color: #256fb8;
	font-size: 14px;
	padding-top: 5px;
}

.blue1 {
	COLOR: #ff7400
}

.blue1 {
	color: #256fb8;
}

.blue2 {
	COLOR: #ff7400
}

.font14 {
	font-size: 14px;
}

.graybutton {
	color: #676767;
}

.v_table001 {
	width: 710px;
	line-height: 22px;
	margin: 0 0 10px 10px;
	padding: 0px;
	text-align: left;
}
</style>
<% 
String permLevel = session.getAttribute( "perm-level") == null ? "0" : session.getAttribute( "perm-level").toString(); 
%>
<script type="text/javascript">

window.onbeforeunload = function()
{
	if(Math.abs(event.clientX - document.body.clientWidth) < 30)
	{
		if (confirm('确实要退出简历管理？'))
			window.location.href("login.action");
		else
			event.returnValue = '请点取消留在本页面！';
	}
}

function init() {
    document.body.oncontextmenu=function(){return false;}
}

function click()   {                                                                                                                             
	if(event.ctrlKey && event.keyCode == 67)   {                                                                                                                     
		return false;                                                          
	}                                                                                                                                                               
}                                                                                                                                                               
document.onkeydown=click;

$(document).ready(function() {
			init();
			permControl();
			
			$("#changeResumeStateClose").button();
			$("#changeResumeStateInprogress").button();
			
			$( "#stateDialog" ).dialog({
				autoOpen: false,
				modal: true,
				buttons: {
					"确 定": function() {
						location.href="resume-review.action?type=0&resumeId=" + document.getElementById("resumeId").value + "&state=" + document.getElementById("state").value + "&changeState=1";
						$( this ).dialog( "close" );
					},
					"取 消": function() {
						$( this ).dialog( "close" );
					}
				},
				close: function() {
				}
			});
			
			var submitResult = <%=submit_result%>
			<%session.setAttribute( "submit_result",-1);%>
			
			if (document.getElementById("resumeState").value == 0) {
				$("#changeResumeStateClose").hide();
			} else {
				$("#changeResumeStateInprogress").hide();
			}
			
			var count = 0;
			var file1 = $("#file1").text();
			if(file1 == null || file1 == "") {
				$("#file1").hide();
				$("#fileOrder1").hide();
				$("#file1Img").hide();
			} else {
				$("#fileOrder1").val(count);
				//document.getElementById("file1").href="${ctx}" + "/upload" + document.getElementById("file1Loc").value;
				count++;
			}
			
			var file2 = $("#file2").text();
			if(file2 == null || file2 == "") {
				$("#file2").hide();
				$("#fileOrder2").hide();
				$("#file2Img").hide();
			} else {
				$("#fileOrder2").val(count);
				//document.getElementById("file2").href="${ctx}" + "/upload" + document.getElementById("file2Loc").value;
				count++;
			}
			
			var file3 = $("#file3").text();
			if(file3 == null || file3 == "") {
				$("#file3").hide();
				$("#fileOrder3").hide();
				$("#file3Img").hide();
			} else {
				$("#fileOrder3").val(count);
				//document.getElementById("file3").href="${ctx}" + "/upload" + document.getElementById("file3Loc").value;
				count++;
			}
			
			var file4 = $("#file4").text();
			if(file4 == null || file4 == "") {
				$("#file4").hide();
				$("#fileOrder4").hide();
				$("#file4Img").hide();
			} else {
				$("#fileOrder4").val(count);
				//document.getElementById("file4").href="${ctx}" + "/upload" + document.getElementById("file4Loc").value;
				count++;
			}
			
			if(submitResult == 1) {
				if (window.confirm("提交成功, 是否要跳转到首页界面?"))
				{
					window.location.href("/resume/resume-main.action?page=0&pageSize=10");
				}
			} else if (submitResult == 2) {
				alert("提交失败");
			}
			
			if (count == 4) {
				$("#titleUploadFile").hide();
				$("#browsFile1").hide();
				$("#submitFile1").hide();
				$("#warningMsg").show();
				$("#submitFile1Tip").show();
			}
});
function openChangeStateDailog() {
	$( "#stateDialog" ).dialog( "open" );
}

function uploadFile() {
	if (document.getElementById("browsFile1").value == null || document.getElementById("browsFile1").value == "") {
		alert("请选择需要上传文件");
	} else {
		document.getElementById("file-upload1").submit();
	}
}

function deleteAttach(order) {
	if (window.confirm("是否要删除这个附件?"))
	{
		window.location.href("/resume/delete-attachment.action?order=" + order);
	}
}

function downloadAttach(order) {
	window.location.href("/resume/down-load.action?order=" + order + "&resumeId=" + document.getElementById("resumeId").value);
}

function permControl() {
	var permLevel = <%=permLevel%>;
	if (permLevel % 10 < 0) {
		$( "#createResume" ).hide();
	}
	if ((permLevel % 100) / 10 < 0) {
		$( "#editResume" ).hide();
	}
	
	if ((permLevel % 100000) / 10000 < 1) {
		$( "#userList" ).hide();
	}
	if ((permLevel % 1000000) / 100000 < 1) {
		$( "#userList" ).hide();
	}
	if ((permLevel % 10000000) / 1000000 < 1) {
		$( "#userList" ).hide();
	}
}

</script>

</head>
<body bgcolor="#ECF5FF">
<div class="top_bar">
	<ul class="nav">
		<li><span class="SayHi">欢迎: 
			<%=session.getAttribute("username")%>
		</span>
		</li>
		<li id="search">
			<a href="/resume/resume-main.action?page=0&pageSize=10">返回首页</a>
		</li>
		<li id="search">
			<a href="/resume/resume-list.action">搜索简历</a>
		</li>
		<li id="createResume">
			<a href="/resume/resume-insert.action">新建简历</a>
		</li>
		<li id="editResume">
			<s:url id="url_edit_resume" value="/resume-edit.action">
				<s:param name="resumeId" value="resumeId"></s:param>
			</s:url>
			<s:a href="%{url_edit_resume}">修改简历</s:a>
		</li>
		<li id="managerResume">
			<a href="/resume/resume-manager.action">简历管理</a>
		</li>
		<li id="userList">
			<a href="/resume/user-list.action">用户列表</a>
		</li>
		<li id="createUser">
			<a href="/resume/user-create.action">新建用户</a>
		</li>
		<li id="userList">
			<a href="/resume/audit-list.action?page=0&pageSize=20">日志</a>
		</li>
		<li>
			<a href="/resume/login.action">退出</a>
		</li>
	</ul>
</div>
	<table>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
	</table>
	<br></br>
	<div>
	<table width="778" border="0" cellpadding="0" align="center">
		<tr>
			<td>
				<table
					style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN: 0px auto; BORDER-RIGHT-WIDTH: 0px"
					cellspacing="0" cellpadding="0" width="760" align="center"
					border="0">
					<tbody>
						<tr>
							<td style="BORDER: #93B0ED 2px solid;" valign="top" colspan="2">
								<table cellSpacing="0" cellpadding="0" width="760"
									align="center" border="0">
									<tbody>
										<tr>
											<td valign="top">
												<table
													style="BORDER: #3076BC 1px solid; PADDING-RIGHT: 0px; PADDING-LEFT: 8px; BACKGROUND: #F5FAFE; PADDING-BOTTOM: 0px; MARGIN: 8px auto; LINE-HEIGHT: 22px; PADDING-TOP: 8px;"
													cellspacing="0" cellPadding="0" width="97%" align="center" 
													border="0">
													<tbody>
														<tr>
															<td><s:label name="resume.name" theme="simple"
																	style="FONT-SIZE: 25px; LINE-HEIGHT: 30px; HEIGHT: 30px"></s:label>
															</td>
															<td>
																<input type="button" onclick="openChangeStateDailog()" id="changeResumeStateClose" style="FONT-SIZE: 12px;" value="状态:关闭" />
																<input type="button" onclick="openChangeStateDailog()" id="changeResumeStateInprogress" style="FONT-SIZE: 12px;" value="状态:进行中"/>
															</td>
														</tr>
														<tr><td>&nbsp;</td></tr>
														<tr>
															<td valign="top">
																<table width="100%" border="0" cellspacing="0"
																	cellpadding="0">
																	<tr>
																		<td width="30%" height="20">性别：</td>
																		<td width="70%" height="20"><s:label
																				name="resume.sex" theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td width="30%" height="20">出生日期：</td>
																		<td width="70%" height="20"><s:label
																				name="resume.dateOfBirth" theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td width="30%" height="20">国籍：</td>
																		<td width="70%" height="20"><s:label
																				name="resume.nationality" theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td width="30%" height="20">现住址：</td>
																		<td width="70%" height="20"><s:label
																				name="resume.address" theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td height="20">联系电话：</td>
																		<td height="20" colspan="3"><s:label
																				name="resume.contactNumber" theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td>所属行业：</td>
																			<td><s:label name="resume.industry" theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td>公司地址：</td>
																		<td><s:label name="resume.workingPlace"
																				theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td class="text_left">工作类型:</td>
																		<td><s:label name="resume.typeOfWork"
																				theme="simple"></s:label></td>
																	</tr>
																	<tr>
																	<td width="59">公司名称：</td>
																		<td width="230"><s:label name="resume.corporation"
																				theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td>职位名称：</td>
																		<td><s:label name="resume.position" theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td width="59">工作年限：</td>
																		<td width="230"><s:label
																				name="resume.workSeniority" theme="simple"></s:label></td>
																	</tr>
																	<tr>
																		<td>目前年薪：</td>
																		<td><s:label name="resume.annualsalary"
																				theme="simple"></s:label></td>
																	</tr>
																
																</table>
															</td>
														</tr>
														<tr><td>&nbsp;</td></tr>
													</tbody>
												</table>
												<table width="97%" border="0" align="center" cellpadding="0"
													cellspacing="0"
													style="margin: 8px auto; line-height: 20px; padding: 0 0 0 8px;" />
												<table width="97%" border="0" align="center" cellspacing="0"
													cellpadding="0" />
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
	</table>
	<div id="upload">
		<table width="100%" border="0" align="left" cellpadding="0"
			cellspacing="0">
			<tr>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td>
					<form id="file-upload1" name="file-upload1"
						action="/resume/file-upload.action" method="post"
						enctype="multipart/form-data">
						<table class="wwFormTable">
							<tr>
								<td class="tdLabel"><label for="browsFile1"
									id="titleUploadFile" class="label">上传简历文件 :</label></td>
								<td><input type="file" name="doc" value="" id="browsFile1" />
								</td>
								<td colspan="2">
									<div align="right">
										<input type="button" id="submitFile1" onclick="uploadFile()"
											value="上 传" />
											
									</div>
								</td>
								<td><div id="submitFile1Tip" style="width:250px"></div></td>
								<td>&nbsp;</td>
							</tr>
						</table>
					</form>
				</td>
			</tr>
			<tr>
				<td>
					<table class="wwFormTable">
						<tr>
							<td><label id="warningMsg" style="display: none">已经上传4个文件, 无法继续上传</label></td>
						</tr>
						<tr>
							<td>已上传简历文件列表:</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					
						<table class="wwFormTable">
							<tr id="fileOrder1">
								<td ></td>
								<td>
									<s:a id="file1" href="" name="file2" theme="simple" onclick="downloadAttach(1)">
										<s:property value='file1' />
									</s:a>
								</td>
							
								<td>
									<form id="delete-attachment" name="delete-attachment"
									action="/resume/delete-attachment.action" method="post">
									<img id="file1Img" src="images/delete.jpg" alt="" onclick="deleteAttach(1)"/>
									</form>
								</td>
							</tr>
							<tr id="fileOrder2">
								<td></td>
								<td>
									<s:a id="file2" href="" name="file2" theme="simple" onclick="downloadAttach(2)">
										<s:property value='file2' />
									</s:a>
								</td>
								<td>
									<form id="delete-attachment" name="delete-attachment"
										action="/resume/delete-attachment.action" method="post">
										<img id="file2Img" src="images/delete.jpg" alt="" onclick="deleteAttach(2)"/>
									</form>
								</td>
							</tr>
							<tr id="fileOrder3">
								<td></td>
								<td>
									<s:a id="file3" href="" name="file3" theme="simple" onclick="downloadAttach(3)">
										<s:property value='file3' />
									</s:a>
								</td>
								<td>
									<form id="delete-attachment" name="delete-attachment"
										action="/resume/delete-attachment.action" method="post">
										<img id="file3Img" src="images/delete.jpg" alt="" onclick="deleteAttach(3)"/>
									</form>
								</td>
							</tr>
							<tr id="fileOrder4">
								<td></td>
								<td>
									<s:a id="file4" href="" name="file4" theme="simple" onclick="downloadAttach(4)">
										<s:property value='file4' />
									</s:a>
								</td>
								<td>
									<form id="delete-attachment" name="delete-attachment"
										action="/resume/delete-attachment.action" method="post">
										<img id="file4Img" src="images/delete.jpg" alt="" onclick="deleteAttach(4)"/>
									</form>
								</td>
							</tr>
						</table>
						<s:hidden id="file1Loc" name="file1Loc"></s:hidden>
						<s:hidden id="file2Loc" name="file2Loc"></s:hidden>
						<s:hidden id="file3Loc" name="file3Loc"></s:hidden>
						<s:hidden id="file4Loc" name="file4Loc"></s:hidden>
						<s:hidden id="resumeId" name="resumeId"></s:hidden>
						<s:hidden id="resumeState" name="resume.state"></s:hidden>
				</td>
			</tr>
		</table>
	</div>
	</div>
	
	<div>
		<s:form id="resume-insert" action="file-upload" method="post">
			<s:hidden name="submitResult"></s:hidden>
		</s:form>
	</div>
	<s:form id="resume-review" action="resume-review" method="post">
		<div id="stateDialog" title="" style="disply: none">
			<s:select id="state" label="状态" name="resume.state" theme="simple" cssClass="select_lrn lr_rd"
									list="#{'0':'跟进中','1':'关闭'}" />
		</div>
	</s:form>
</body>
</html>
